// 登录状态管理,登录状态会产生哪些数据
const state = {
  isLogin: localStorage.getItem('isLogin') || '',
  userId: localStorage.getItem('userId') || '',
  token: localStorage.getItem('token') || ''
}

const action = {}

// 状态管理器内部,专属的修改状态数据的唯一方式
const mutations = {
  change_isLogin: (state, payload) => {
    state.isLogin = payload
  },
  change_userId: (state, payload) => {
    state.userId = payload
  },
  change_token: (state, payload) => {
    state.token = payload
  }
}

export default {
  state,
  action,
  mutations,
  namespaced: true // 可以使用user/change_isLogin找到修改数据的方法
}
